package com.springmvc.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

@Configuration
@EnableAspectJAutoProxy //开启 AspectJ 的自动代理
public class AppConfig {

    @Bean
    public SimpleMappingExceptionResolver exception(){
        System.out.println("自定义的bean处理异常....");
        SimpleMappingExceptionResolver error = new SimpleMappingExceptionResolver();
        error.setDefaultErrorView("error");
        error.setExceptionAttribute("ex");

        return error;
    }

}
